<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@include file="init.jsp"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/scrip.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>View Category Admin</title>
</head>
<body>
<div class="master-wrapper-content">
	<jsp:include page="heading.jsp"></jsp:include>
	<%
		if(session.getAttribute("roleId") == null || String.valueOf(session.getAttribute("roleId")).equalsIgnoreCase("2")) {
			%>
				<h3 style="color: red">Không đủ quyền để truy cập</h3>
			<%
		}
		else {
	%>
	<jsp:include page="CategoryAdmin.jsp"></jsp:include>
	<div class="container-right">
		<%
			List<String> categoryNames = new ArrayList<String>();
			List<Integer> categoryIds = new ArrayList<Integer>();
	
			dataManager.getTreeStructure(categoryIds, categoryNames);
		%>
			<div class="ml-banner">
				<div class="ml-title">Quản lý Category</div>
			</div>
			<form action="ManageCategory" action="post">
				<select name="categoryId">
					<option value="0">root</option>
					<%
						for (int i = 0; i < categoryIds.size(); ++i) {
					%>
					<option value="<%=categoryIds.get(i)%>"><%="    ".replace(" ", "&nbsp") + 
						categoryNames.get(i).replace(" ", "&nbsp")%></option>
					<%
						}
					%>
				</select> <br> <input type="submit" name="manageCategory" value="Edit" />
				<input type="submit" name="manageCategory" value="Delete" /> <br>
				<br>
				<p>Thêm thư mục</p>
				<table border="1">
					<tr>
						<td>Tên thư mục</td>
						<td><input type="text" name="categoryName" />
						</td>
						<td><input type="submit" name="manageCategory" value="Add" />
						</td>
					</tr>
				</table>
			</form>
		</div>
		<div class="clear"></div>
		<%
		}
		%>
	<jsp:include page="footer.jsp"></jsp:include>
</div>
</body>
</html>